package pri.hillchen.std.design.pattern.single;

/**
 * 双段校验单例模式
 * Created by hillchen on 2018/3/9.
 */
public class LazyByDoubleCheck {
    private LazyByDoubleCheck(){}
    private static LazyByDoubleCheck lazyByDoubleCheck = null;

    public static LazyByDoubleCheck getInstance(){
        if(lazyByDoubleCheck == null){
            synchronized (LazyByDoubleCheck.class){
                if(lazyByDoubleCheck == null){
                    lazyByDoubleCheck = new LazyByDoubleCheck();
                }
            }
        }
        return lazyByDoubleCheck;
    }

}
